import 'package:flutter/services.dart';

class NativeCall {
  static const MethodChannel _channel = MethodChannel('com.example.app/native');

  // 调用 iOS 原生方法
  static Future<String> callNativeMethod(String parameter) async {
    try {
      final String result = await _channel.invokeMethod('nativeMethod', {
        'param': parameter,
        'timestamp': DateTime.now().millisecondsSinceEpoch,
      });
      return result;
    } on PlatformException catch (e) {
      return "Failed to invoke native method: '${e.message}'.";
    }
  }
}
